from django.db import models

# Create your models here.

class Chapter(models.Model):
    identifier = models.CharField(max_length=20)
    name = models.CharField(max_length=50, null=True)
    content = models.TextField(null=True)
    parent = models.CharField(max_length=20, null=True)
    def __unicode__(self):
        return self.identifier + self.name
       
class Exercise(models.Model):
    identifier = models.CharField(max_length=20)
    question = models.TextField()
    answer = models.TextField(null=True)
    author = models.ForeignKey('People')
    chapter = models.ForeignKey('Chapter')
    def __unicode__(self):
        return self.identifier
     
class People(models.Model):
    name = models.CharField(max_length=20)
    about = models.TextField(null=True)
    email = models.EmailField(null=True)
    def __unicode__(self):
        return self.name    